package com.bs.repository;

import com.bs.domain.AlertMemo;
import com.bs.domain.AlertMemoQuery;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by wujian
 * Date: 2017-12-12
 * Time: 11:38
 */
public interface AlertMemoRepository extends JpaRepository<AlertMemo, Long>, JpaSpecificationExecutor<AlertMemo> {
    @Query(value = "select new com.bs.domain.AlertMemoQuery" +
        "(m.id,m.alertName,m.partitionId,m.moduleName,m.userNo ,u.userName, m.msgType,m.recCreateTime,m.alertMsg) " +
        "from AlertMemoArchive m,AlertUser u where m.userNo=u.userId")
    Page<AlertMemoQuery> findAlertMemoInfo(Pageable pageable);
}
